Skip to main content
Glama
route.ts894 B
import { readFile } from "node:fs/promises"; import { getAssetById } from "@repo/db/database/admin"; import type { NextRequest } from "next/server"; export const dynamic = "force-dynamic"; export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const { id } = await params; try { const asset = await getAssetById(id); if (!asset) { return Response.json({ error: "资产不存在" }, { status: 404 }); } // 读取文件 const buffer = await readFile(asset.path); // 返回文件 return new Response(buffer, { headers: { "Content-Type": asset.contentType, "Content-Disposition": `inline; filename="${asset.fileName}"`, }, }); } catch (error) { console.error("获取资产失败:", error); return Response.json({ error: "获取资产失败" }, { status: 500 }); } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/metacode0602/open-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server